package cn.edu.lingnan.servlet;

import cn.edu.lingnan.pojo.User;
import cn.edu.lingnan.service.userservice;
import cn.edu.lingnan.service.userserviceimp;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;


public class EnabledAndDisabledServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Integer id = Integer.parseInt(req.getParameter("id"));
        Integer identity = Integer.parseInt(req.getParameter("identity"));
        System.out.println("启用或者禁用用户id=" + id + " 身份=" + identity);
        userservice us = new userserviceimp();
        us.EnabledAndDisabled(id, identity);

        // 禁止页面缓存
        resp.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
        resp.setHeader("Pragma", "no-cache");
        resp.setDateHeader("Expires", 0);

        // 重定向回原页面
        resp.sendRedirect(req.getContextPath() + "/manager/my.jsp");
    }
}
